--[[

--]]


local function gettime()
    return g.getMsec()
end

local M = class("Ball")

function M:ctor(id)
    self.id = id
    self.stop = true
    self.goin = 0
    local kind = 0
    if id > 10 then
        kind = 2
    else
        kind = 1
    end
    --if k == 22 then kind = 2 end

    self.kind = kind --类型 0手球，白，黑，红色
    self.vx = 0 --速度
    self.vy = 0
    self.x = 0
    self.y = 0


    self:register()
end

function M:register()

end

function M:reset()
    self.x = 0
    self.y = 0
    self.vx = 0
    self.vy = 0
    self.goin = 0
end

function M:setPosition(x, y)
    self.x = x
    self.y = y
end

function M:getPosition()
    return self.x, self.y
end

function M:setVec(x, y)
    self.vx = x
    self.vy = y
end

function M:setGoin(goin)
    self.goin = goin
end

function M:getInfo()
    return {
        pos_x = self.x,
        pos_x = self.y,
        vel_x = self.vx,
        vel_y = self.vy,
        goin = self.goin,
        id = self.id,
        tag = self.kind,
    }
end

function M:getKind()
    return self.kind
end

function M:setKind(kind)
    self.kind = kind
end

function M:isCueBall()
    if self.kind == 0 and self.id == 1 then
        return true
    end
    return false
end

function M:isRedBall()
    if self.kind == 3 then
        return true
    end
    return false
end


return M